package schema

import (
	"entgo.io/ent"
	"entgo.io/ent/dialect/entsql"
	"entgo.io/ent/schema"
	"entgo.io/ent/schema/field"
	"entgo.io/ent/schema/index"
	"private-domain-overseas-service/pkg/status/bizuser"
	"time"
)

type HzUserSurvey struct {
	ent.Schema
}

// Fields of the HzUserSurvey.
func (HzUserSurvey) Fields() []ent.Field {
	return []ent.Field{
		field.String("user_survey_phone").NotEmpty().Unique().Comment("用户手机号"),
		field.String("user_survey_name").Optional().Comment("用户称呼"),
		field.Int64("user_survey_sex").Default(bizuser.UserSexMen).Comment("用户性别 1、男，2、女,3、保密"),
		field.Int64("user_survey_order_num").Optional().Comment("用户订购数量"),
		field.Int64("user_survey_type").Default(bizuser.UserTypeOrdinary).Optional().Comment("用户类型，1、普通用户，2、定向邀请用户"),
		field.Int64("created_at").Immutable().Default(time.Now().Unix()).Comment("创建时间"),
		field.Int64("update_at").Default(time.Now().Unix()).Comment("更新时间"),
		field.Int64("delete_at").Optional().Comment("删除时间"),
	}
}

// Indexes of the Street.
func (HzUserSurvey) Indexes() []ent.Index {
	return []ent.Index{
		index.Fields("user_survey_phone"),
	}
}

func (HzUserSurvey) Annotations() []schema.Annotation {
	return []schema.Annotation{
		entsql.WithComments(true),
		schema.Comment("用户问卷表"),
	}
}
